﻿<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=no">
			<meta http-equiv = "pragma" content = "no-cache">
<meta http-equiv = "Cache-Control" content = "no-cache,must-revalidate">
<meta http-equiv = "expires" content = "0">
<title>淘车网-优质二手车交易平台</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/reality-icon.css">
<link rel="stylesheet" type="text/css" href="css/bootsnav.css">
<link rel="stylesheet" type="text/css" href="css/owl.carousel.css">
<link rel="stylesheet" type="text/css" href="css/owl.transitions.css">
<link rel="stylesheet" type="text/css" href="css/settings.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/range-Slider.min.css">
<link rel="stylesheet" type="text/css" href="css/search.css">
<link href="css/popup-box.css" rel="stylesheet" type="text/css" media="all" />
<link rel="icon" href="images/icon.png">
<script src="js/jquery-2.1.4.js"></script>
<script type="text/javascript">
var action = "/getUserInfo";
$.get(
	action,
	function(data) {
		var user_info = data;
		var old = '';
		if(user_info.name==null||user_info.userTypeId != '3'){
			window.location.href='login.html';
		}
		else{
			old += '<ul class="nav navbar-nav" data-in="fadeIn" data-out="fadeOut"><li><a href="index.html">首页</a></li><li><a href="favorite.html">收藏夹</a></li><li class="dropdown megamenu-fw active"><a href="userInfo.html">个人中心</a></li><li><a href="javascript:void(0);" onclick="logout()">退出登录</a></li></ul>';
		$("#navbar-menu").html(old);
		if(data.infoPermission=='0'){
			$("#aaa").html('<a class=" popup-with-zoom-anim button-isi zoomIn animated" data-wow-delay=".5s" href="javascript:void(0);" onclick="openRecommend()">打开推荐</a>');
		}
		var old2 = "";
		old2 += '<h3 id="name">&ensp;'
		+ user_info.name
		+'</h3><p class="bottom30">&ensp;&ensp;'
		+ user_info.username
		+'</p><table class="agent_contact table"> <tbody><tr class="bottom10"><td><strong >手机:</strong></td><td class="text-left" id="tel">'
		+ user_info.tel+'</td></tr><tr class="bottom10"><td><strong>地区:</strong></td><td class="text-left">'
		+ user_info.location +'</td></tr><tr class="bottom10"><td><strong>年龄:</strong></td><td class="text-left">'
		+ user_info.age ;
	
		$.get(
				"/getUserPrefer",
			function(data) {
				old2 +='</td></tr><tr class="bottom10"><td><strong>偏好品牌:</strong></td><td class="text-left">'
					+ data.brandName +'</td></tr><tr class="bottom10"><td><strong>偏好类型:</strong></td><td class="text-left">'
					+ data.classifyName +'</td></tr><tr class="bottom10"><td><strong>偏好车系:</strong></td><td class="text-left">'
					+ data.seriesName +'</td></tr><tr class="bottom10"><td><strong>偏好颜色:</strong></td><td class="text-left">'
					+ data.colorName
					+'</td></tr></tbody></table><div style="border-bottom:1px solid #d3d8dd;" class="bottom15"></div><ul class="social_share"><li><a href="javascript:void(0)" class="facebook"><i class="icon-facebook-1"></i></a></li><li><a href="javascript:void(0)" class="twitter"><i class="icon-twitter-1"></i></a></li><li><a href="javascript:void(0)" class="google"><i class="icon-google4"></i></a></li><li><a href="javascript:void(0)" class="linkden"><i class="fa fa-linkedin"></i></a></li><li><a href="javascript:void(0)" class="vimo"><i class="icon-vimeo3"></i></a></li></ul>';
				$("#userInfo").html(old2);
				}
		);

				}
	}
);

action = "/getBrandSelectBox";
$.get(
	action,
	function(data) {
		var list = data;
		var old = $("#selectBrandBox").html();
		old += "<select id=\"selectedBrand\"><option value=\"-1\" class=\"active\">品牌-不限</option>";
		for (i in list) {
			var item = list[i];
			old +=
				"<option value=" + item.pid + ">" + item.pname + "</option>";
		}
		old += "</select>";
		$("#selectBrandBox").append(old);
		$('#selectedBrand').zelect();
	}
);
action = "/getSeriesSelectBox";
$.get(
	action,
	function(data) {
		var list = data;
		var old = $("#selectSeriesBox").html();
		old += "<select id=\"selectedSeries\"><option value=\"-1\" class=\"active\">车系-不限</option>";
		for (i in list) {
			var item = list[i];
			old +=
				"<option value=" + item.cxid + ">" + item.cxname + "</option>";
		}
		$("#selectSeriesBox").html(
			old + "</select>");
		$('#selectedSeries').zelect();
	}
);
action = "/getClassifySelectBox";
$.get(
	action,
	function(data) {
		var list = data;
		var old = $("#selectClassifyBox").html();
		old += "<select id=\"selectClassify\"><option value=\"-1\" class=\"active\">类型-不限</option>";
		for (i in list) {
			var item = list[i];
			old +=
				"<option value=" + item.cid + ">" + item.cname + "</option>";
		}
		$("#selectClassifyBox").html(
			old + "</select>");
		$('#selectClassify').zelect();
	}
);
action = "/getColorSelectBox";
$.get(
	action,
	function(data) {
		var list = data;
		var old = $("#selectColorBox").html();
		old += "<select id=\"selectedColor\"><option value=\"-1\" class=\"active\">颜色-不限</option>";
		for (i in list) {
			var item = list[i];
			old +=
				"<option value=" + item.colorId + ">" + item.colorName + "</option>";
		}
		$("#selectColorBox").html(
			old + "</select>");
		$('#selectedColor').zelect();
	}
);
function changePsw(){
	var oldPsw =  $("#oldPsw").val();
	var newPsw =  $("#newPsw").val();
	var checkedPsw =  $("#checkedPsw").val();
	if(oldPsw==null||oldPsw==''||newPsw==null||newPsw==''||checkedPsw==null||checkedPsw==''){
		alert('密码不能为空！');
		return false;
	}
	if(newPsw!=checkedPsw){
		alert('两次输入密码不一致');
		return false;
	}
	var url = "/changePsw?oldPsw=" + oldPsw +"&newPsw="+ newPsw;
	$.get(
			url,
			function(data) {
				if(data==0){
					alert('密码修改有误，请重试！');
				}
				if(data==1){
					alert('密码修改成功，请重新登录！');
					var url = '/logout';
					$.get(
							url,
							function(data) {
							if(data==1){
								window.location.href = 'login.html';							}
							if(data==0){
								alert('退出有误！');
							}
							}
							);
					
				}
			});
};

function changeUserInfo(){
	var newName =  $("#newName").val();
	var newTel =  $("#newTel").val();
	var newAge =  $("#newAge").val();
	var newLocation =  $("#newLocation").val();

	if(newName==null||newName==''||newTel==null||newTel==''||newAge==null||newAge==''||newLocation==null||newLocation==""){
		alert('信息不能为空！');
		return false;
	}
	if(!(/^1[3456789]\d{9}$/.test(newTel))){ 
        alert("手机号码格式有误，请重新填写！"); 
		return false;
	}
	var url = "/changeUserInfo?newName=" + newName +"&newTel="+ newTel+"&newLocation="+ newLocation +"&newAge="+ newAge;
	$.get(
			url,
			function(data) {
				if(data==0){
					alert('信息修改有误，请重试！');
				}
				if(data==1){
					alert('信息修改成功！');	
					window.location.reload();
				}
			});
};
function changeLike(){
	var selectedBrand = $("#selectBrandBox option:selected").val();
	var selectedSeries = $("#selectSeriesBox option:selected").val();
	var selectedClassify = $("#selectClassifyBox option:selected").val();
	var selectedColor = $("#selectColorBox option:selected").val();
	if(selectedBrand == -1){selectedBrand = "品牌-不限"};
	if(selectedSeries == -1){selectedSeries = "车系-不限"};
	if(selectedClassify == -1){selectedClassify = "类型-不限"};
	if(selectedColor == -1){selectedColor = "颜色-不限"};

	var url = "/changeUserInfo?selectedBrand="+selectedBrand+"&selectedSeries="+selectedSeries+"&selectedClassify="+selectedClassify+"&selectedColor="+selectedColor;
	$.get(
			url,
			function(data) {
				if(data==0){
					alert('个人偏好修改有误，请重试！');
				}
				if(data==1){
					alert('个人偏好修改成功！');	
					window.location.reload();
				}
			});
};
</script>
</head>
<body>
 
<!--Header-->
<header class="layout_default">

  <nav class="navbar navbar-default navbar-sticky bootsnav">
    <div class="container">
      <div class="row">
        <div class="col-md-12">
          <!-- Start Header Navigation -->
          <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-menu">
            <i class="fa fa-bars"></i>
            </button>
          </div> <!-- End Header Navigation -->
          <div class="collapse navbar-collapse" id="navbar-menu">
          </div>
        </div>
      </div>
    </div>
  </nav>
</header>
<!--Header Ends-->

<!-- Page Banner Start-->
<section class="page-banner padding">
  <div class="container">
    <div class="row">
      <div class="col-md-12 text-center">
        <h1 class="text-uppercase">买二手车  上淘车网</h1>
        <p>上 万 款 优 质 二 手 车 恭 候 您 的 挑 选</p>
      </div>
    </div>
  </div>
</section>
<!-- Page Banner End -->


<!-- News Start -->
<section id="news-section-1" class="property-details padding_top">

   <div class="container property-details">
      <div class="row">
	  <div class="col-md-8 listing1">
        <div class="row">
          <div class="col-sm-6 bottom40">
            <div class="agent_wrap">
              <div class="image">
                <img src="images/agent-three.jpg" alt="Agents">
              </div>
            </div>
          </div>
          <div class="col-sm-6 bottom40">
            <div class="agent_wrap" id="userInfo">

            </div>
          </div>
                    <div class="col-sm-6 bottom40">
            <div class="agent_wrap" id="LikeInfo">

            </div>
          </div>
        </div>
      </div>
         <aside class="col-md-4 col-xs-12">
		 
            <div class="row">
               <div class="col-md-12">
                  <h3 class="bottom20">编辑个人资料</h3>
                  <ul class="pro-list bottom20">
                     <li>				<div class="more">
					<a class=" popup-with-zoom-anim button-isi zoomIn animated" data-wow-delay=".5s" href="#small-dialog3" id="changePsw">修改密码</a>				
				</div>
                     </li>
                     </br>
                     <li>				<div class="more">
					<a class=" popup-with-zoom-anim button-isi zoomIn animated" data-wow-delay=".5s" href="#small-dialog2" id="changeInfo">修改个人信息</a>				
				</div>
                     </li></br>
                                          <li>				<div class="more">
					<a class=" popup-with-zoom-anim button-isi zoomIn animated" data-wow-delay=".5s" href="#small-dialog" id="changeLike">修改个人偏好</a>				
				</div>
                     </li>
                  </ul>
                                    <h3 class="bottom20">其它功能</h3>
                  <ul class="pro-list bottom20">
                     <li>				<div class="more" id="aaa">
					<a class=" popup-with-zoom-anim button-isi zoomIn animated" data-wow-delay=".5s" href="javascript:void(0);" onclick="clickRecommend()">关闭推荐</a>				
				</div>
                     </li>
                     </ul>
               </div>
            </div>
         </aside>
      </div>
   </div>
</section>
<!-- News End -->

	<!-- changeInfo -->
	<div class="pop-up"> 
		<div id="small-dialog" class="mfp-hide book-form">
		<h3>修改个人偏好 </h3>
			<form action="#" method="post">
																								<div class="search-2 col-sm-12">
									<div class="row">
										<div class="col-sm-6">
											<div class="single-query form-group">
												<div class="intro" id="selectBrandBox">
												</div>
											</div>
										</div>
											<div class="col-sm-6">
											<div class="single-query form-group">
												<div class="intro" id="selectSeriesBox">
												</div>
											</div>
										</div>
									</div>
								</div>
																<div class="search-2 col-sm-12">
									<div class="row">
										<div class="col-sm-6">
											<div class="single-query form-group">
												<div class="intro" id="selectColorBox">
												</div>
											</div>
										</div>
											<div class="col-sm-6">
											<div class="single-query form-group">
												<div class="intro" id="selectClassifyBox">
												</div>
											</div>
										</div>
									</div>
								</div>
								<h1>&ensp;</h1>
				<center>
				<button type="button" class="btn-blue border_radius" onclick="return changeLike()">确认修改</button>
				</center>
			</form>
	</div>
			<div id="small-dialog2" class="mfp-hide book-form">
<h3>修改个人信息 </h3>
<form action="#" method="post">
<p>修改昵称</p><input type="text" id="newName" required=""/>
<p>修改手机号</p><input type="text" id="newTel" required=""/>
<p>修改地区</p><input type="text" id="newLocation" required=""/>
<p>修改年龄</p><input type="text" id="newAge" required=""/>	
				<center>
				<button type="button" class="btn-blue border_radius" onclick="return changeUserInfo()">确认修改</button>
				</center></form>
	</div>
	
		<div id="small-dialog3" class="mfp-hide book-form">
		<h3>修改密码 </h3>
			<form action="#" method="post">
				<p>请输入原密码：</p>
				<input type="password" id="oldPsw" class="password" placeholder="" required=""/>
				<p>请输入新密码：</p>
				<input type="password" id="newPsw" class="password" placeholder="" required=""/>
				<p>请重复新密码：</p>
				<input type="password" id="checkedPsw" class="password" placeholder="" required=""/>					
				<center>
				<button type="button" class="btn-blue border_radius" onclick="return changePsw()">确认修改</button>
				</center>
			</form>
	</div>
</div>	
<!-- // changeInfo  -->

<!--Footer-->
<footer class="footer_third">
  <div class="container padding_top">
    <!--CopyRight-->
    <div class="copyright_simple">
      <div class="row">
        <div class="col-md-6 col-sm-5 top20 bottom20">
          <p>Copyright &copy; 2020 <span>TaoCheNet</span>. All rights reserved.</p>
        </div>
        <div class="col-md-6 col-sm-7 text-right top15 bottom10">
          <ul class="social_share">
            <li><a href="#." class="facebook"><i class="icon-facebook-1"></i></a></li>
            <li><a href="#." class="twitter"><i class="icon-twitter-1"></i></a></li>
            <li><a href="#." class="google"><i class="icon-google4"></i></a></li>
            <li><a href="#." class="linkden"><i class="fa fa-linkedin"></i></a></li>
            <li><a href="#." class="vimo"><i class="icon-vimeo3"></i></a></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</footer>


<script src="js/bootstrap.min.js"></script> 
<script src="js/bootsnav.js"></script>
<script src="js/jquery.parallax-1.1.3.js"></script>
<script src="js/jquery.appear.js"></script>
<script src="js/jquery-countTo.js"></script>
<script src="js/masonry.pkgd.min.js"></script>
<script src="js/range-Slider.min.js"></script>
<script src="js/owl.carousel.min.js"></script> 
<script src="js/jquery.cubeportfolio.min.js"></script>
<script src="js/selectbox-0.2.min.js"></script>
<script src="js/zelect.js"></script>
<script src="js/jquery.fancybox.js"></script>
<script src="js/jquery.themepunch.tools.min.js"></script>
<script src="js/jquery.themepunch.revolution.min.js"></script>
<script src="js/revolution.extension.layeranimation.min.js"></script>
<script src="js/revolution.extension.navigation.min.js"></script>
<script src="js/revolution.extension.parallax.min.js"></script>
<script src="js/revolution.extension.slideanims.min.js"></script>
<script src="js/revolution.extension.video.min.js"></script>
<script src="js/custom.js"></script>
<script src="js/functions.js"></script>
<script src="js/jquery.magnific-popup.js" type="text/javascript"></script>
<script type="text/javascript" src="js/modernizr.custom.53451.js"></script> 
<script>
						$(document).ready(function() {
						$('#changeInfo').magnificPopup({
							type: 'inline',
							fixedContentPos: false,
							fixedBgPos: true,
							overflowY: 'auto',
							closeBtnInside: true,
							preloader: false,
							midClick: true,
							removalDelay: 300,
							mainClass: 'my-mfp-zoom-in'
						});
						$('#changeLike').magnificPopup({
							type: 'inline',
							fixedContentPos: false,
							fixedBgPos: true,
							overflowY: 'auto',
							closeBtnInside: true,
							preloader: false,
							midClick: true,
							removalDelay: 300,
							mainClass: 'my-mfp-zoom-in'
						});
						$('#changePsw').magnificPopup({
							type: 'inline',
							fixedContentPos: false,
							fixedBgPos: true,
							overflowY: 'auto',
							closeBtnInside: true,
							preloader: false,
							midClick: true,
							removalDelay: 300,
							mainClass: 'my-mfp-zoom-in'
						});
						        });  
						function logout(){
							var url = '/logout';
							$.get(
									url,
									function(data) {
									if(data==1){
										window.location.reload();
									}
									if(data==0){
										alert('退出有误！');
									}
									}
									);
						};
						
						function clickRecommend(){
							var str="/inverseInfoPermission"
								$.ajax({
									type : "post",
									url : str,

									contentType : "application/json;charset=UTF-8",
									success : function(result) {
										if(result==true){
											alert('关闭推荐成功');
											window.location.reload();
										}
										if(result==false){
											alert('关闭推荐失败');
										}
									},
									error : function(result) {
										alert("err back");
									}
								});
						}
						
						function openRecommend(){
							var str="/inverseInfoPermission"
								$.ajax({
									type : "post",
									url : str,

									contentType : "application/json;charset=UTF-8",
									success : function(result) {
										if(result==true){
											alert('打开推荐成功');
											window.location.reload();
										}
										if(result==false){
											alert('打开推荐失败');
										}
									},
									error : function(result) {
										alert("err back");
									}
								});
						}
</script>
</body>
</html>

